<!DOCTYPE html>
<html>

	<head>
		<meta charset="utf-8">
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<title>APP</title>
		<link href="css/weui.min.css" rel="stylesheet" />
		<link href="css/jquery-weui.min.css" rel="stylesheet" />
		<link href="css/style.css" rel="stylesheet" />
		<link href="css/flex.css" rel="stylesheet" />
		<link href="fonts/iconfont.css" rel="stylesheet" />
		<script src="js/immersed.js"></script>
	</head>
	<style>
		* {
			margin: 0;
			padding: 0;
			list-style: none;
			border: 0;
			-webkit-box-sizing: border-box;
			box-sizing: border-box;
			-webkit-tap-highlight-color: transparent;
		}
		
		input {
			-webkit-appearance: none;
		}
		
		html,
		body {
			width: 100%;
			background-color: #fff;
			overflow-y: hidden;
		}
		
		.header {
			background-image: url(images/banner_bg.jpg);
			background-repeat: no-repeat;
			background-position: 0 0;
			background-size: 100% auto;
			text-align: center;
			padding: 70px 0;
		}
		
		.logo {
			width: 40%;
		}
		
		#login1 {
			padding: 20px 20px;
		}
		
		.yiui-phone-input {
			border: #ccc 1px solid;
			height: 50px;
			line-height: 30px;
			font-size: 16px;
			width: 100%;
			border-radius: 5px;
			background-color: #fff;
			text-indent: 40px;
		}
		
		.yiui-phone-input:focus {
			border: #c1c1c1 1px solid;
			outline: none;
		}
		
		.yiui-input-row {
			justify-content: center;
			position: relative;
			margin: 10px 0;
			height: 50px;
		}
		
		.yiui-input-row .sicon {
			position: absolute;
			left: 10px;
			top: 7px;
			font-size: 25px;
			color: #999
		}
		
		.yiui-input-row .reloadverify {
			position: absolute;
			right: 1px;
			top: 1px;
			height: 48px;
			border-radius: 5px;
		}
		
		.next {
			background-color: #45A75C;
			color: #fff;
			display: block;
			width: 100%;
			height: 50px;
			border-radius: 5px;
			font-size: 16px;
		}
		
		.next:focus {
			outline: none;
		}
		
		.next.disabled {
			background-color: #91ac97;
			color: #666
		}
		
		.next2 {
			background-color: #fff;
			color: #45A75C;
			display: block;
			width: 100%;
			height: 50px;
			border-radius: 5px;
			font-size: 14px;
		}
		
		.next2:focus {
			outline: none;
		}
		
		.next2.disabled {
			background-color: #91ac97;
			color: #666
		}
	</style>

	<body>
		<div id="app">

			<div class="header">
				<img src="images/logo.png" class="logo">
			</div>
			<div id="login1">
				<div>

					<div class="yiui-input-row">
						<i class="iconfont icon-mobile sicon"></i>
						<input type="tel" value="" id="phone" name="phone" placeholder="手机号" class="yiui-phone-input sphone">
					</div>

					<div class="yiui-input-row">
						<i class="iconfont icon-lock sicon"></i>
						<input type="password" value="" id="password" name="password" placeholder="登录密码" class="yiui-phone-input sphone">
					</div>

					<div class="yiui-input-row" style="margin-top: 10px;">
						<button id='nextBtn' class="next">登 录</button>
					</div>
					<br />
					<div class="yiui-input-row">
						<div class="weui-flex">
							<div class="weui-flex__item">
								<a class="next2" onclick="clicked('contact.html')" style="color: #999;"><i class="iconfont icon-wang"></i> 联系客服</a>
							</div>
							<div class="weui-flex__item" style="text-align: right;">
								<a class="next2" onclick="clicked('phone_login.html')"> 短信验证码登录</a>
							</div>
						</div>
					</div>

				</div>
			</div>

		</div>

		<script src="js/mui.min.js"></script>
		<script src="js/jquery-2.1.4.js"></script>
		<script src="js/jquery-weui.min.js"></script>
		<script src="js/vue.js"></script>
		<script src="js/smarge.js"></script>
		<script src="js/common.js"></script>
		<script src="js/update.app.js"></script>
		<script type="text/javascript" charset="utf-8">
			mui.init();

			mui.plusReady(function() {
				// 关闭侧滑返回功能
				var wv = plus.webview.currentWebview();
				wv.setStyle({
					'popGesture': 'none'
				});
				//提示升级
				updateApp()

//				var token = getToken() || undefined;
//				if(token != undefined) {
//					plus.nativeUI.showWaiting('自动登录...')
//					Get(SERVER_URL + '&c=User&a=getInfo', {}, function(data) {
//						if(data.status) {
//							Smarge.set('userinfo', data.info);
//							setTimeout(function() {
//								plus.nativeUI.closeWaiting()
//								clicked('main.html');
//							}, 300)
//						} else {
//							plus.nativeUI.closeWaiting()
//							plus.nativeUI.alert(data.info, function() {
//								Smarge.set('userinfo', '');
//							}, "提示", "确定");
//						}
//					})
//				}

				$(document).on('click', '#nextBtn', function(e) {

					var _phone = $("#phone").val();
					var _password = $("#password").val();
					var _data = {
						phone: _phone,
						password: _password
					}

					$("#nextBtn").html("提交中...").attr('disabled', true).addClass('disabled');

					Get(SERVER_URL + '&c=public&a=pwdLogin', _data, function(data) {
						$("#nextBtn").html("登录").attr('disabled', false).removeClass('disabled');
						if(data.status) {
							Smarge.set('userinfo', data.info);
							plus.runtime.restart();
							mui.toast('登录成功');
						} else {
							$(".reloadverify").click();
							mui.alert(data.info);
						}
					});

				});

			});

			(function($, doc) {
				$.plusReady(function() {
					$.oldBack = mui.back;
					var backButtonPress = 0;
					$.back = function(event) {
						backButtonPress++;
						if(backButtonPress > 1) {
							plus.runtime.quit();
						} else {
							plus.nativeUI.toast('再按一次退出应用');
						}
						setTimeout(function() {
							backButtonPress = 0;
						}, 1000);
						return false;
					};
				});
			}(mui, document));
		</script>
	</body>

</html>